<template>
	<div class="mine">
		<div class="member-center-main">
			<div class="member-center-menu">
				<div class="info-block">
					<div class="playerid">{{info.name}}</div>
				</div>
				<div class="balance-info">
					<div class="currency">{{$t('indexTitle.title23')}}</div>
					<div class="balance">{{info.money||0}}</div>
				</div>
				<div class="nav-block">
					<div class="item" :class="tab == 0 ? 'active':''" @click="goNextPage('/mine')">
						<img src="../../assets/images/icon.png" alt="" />
						<div class="label">{{$t('indexTitle.title24')}}</div>
					</div>
					<div class="item" :class="tab == 1 ? 'active':''" @click="goNextPage('/vipRebates')">
						<img src="../../assets/images/icon.png" alt="" />
						<div class="label">{{$t('indexTitle.title321')}}</div>
					</div>
					<div class="item" :class="tab == 2 ? 'active':''" @click="goNextPage('/deposit')">
						<img src="../../assets/images/icon.png" alt="" />
						<div class="label">{{$t('indexTitle.title26')}}</div>
					</div>
					<div class="item" :class="tab == 3 ? 'active':''" @click="goNextPage('/withdraw')">
						<img src="../../assets/images/icon.png" alt="" />
						<div class="label">{{$t('indexTitle.title27')}}</div>
					</div>
					<!-- <div class="item" :class="tab == 4 ? 'active':''" @click="goNextPage('/affiliate')">
						<img src="../../assets/images/icon.png" alt="" />
						<div class="label">{{$t('indexTitle.title28')}}</div>
					</div> -->
					<div class="item" :class="tab == 5 ? 'active':''" @click="goNextPage('/mission')">
						<img src="../../assets/images/icon.png" alt="" />
						<div class="label">{{$t('indexTitle.title29')}}</div>
					</div>
					<div class="item" :class="tab == 6 ? 'active':''" @click="goNextPage('/promotions')">
						<img src="../../assets/images/icon.png" alt="" />
						<div class="label">{{$t('indexTitle.title30')}}</div>
					</div>
					<div class="item" :class="tab == 7 ? 'active':''" @click="goNextPage('/game-history')">
						<img src="../../assets/images/icon.png" alt="" />
						<div class="label">{{$t('indexTitle.title31')}}</div>
					</div>
					<div class="item" :class="tab == 8 ? 'active':''" @click="goNextPage('/finan-history')">
						<img src="../../assets/images/icon.png" alt="" />
						<div class="label">{{$t('indexTitle.title32')}}</div>
					</div>
					<div class="item" :class="tab == 9 ? 'active':''" @click="goNextPage('/personalMsg')">
						<img src="../../assets/images/icon.png" alt="" />
						<div class="label">{{$t('indexTitle.title33')}}</div>
					</div>
				</div>
			</div>
			<div class="member-center-content">
				<div class="member-center-profile">
					<div class="title-wrapper">
						<img @click="goBack()" class="left" src="../../assets/images/fanhuijiantou.png" alt="">
						<div class="title" v-if="title == 0">{{$t('indexTitle.title105')}}</div>
						<div class="title" v-if="title == 1">{{$t('indexTitle.title106')}}</div>
						<div class="title" v-if="title == 2">{{$t('indexTitle.title107')}}</div>
						<div class="title" v-if="title == 3">{{$t('indexTitle.title108')}}</div>
						<div class="title" v-if="title == 4">{{$t('indexTitle.title109')}}</div>
						<div class="title" v-if="title == 5">{{$t('indexTitle.title110')}}</div>
						<div class="title" v-if="title == 6">{{$t('indexTitle.title111')}}</div>
					</div>
					<div class="proList" v-if="isShowLook">
						<div class="dfafaTimeBox">
							<div class="magBox">
								<div class="input-block"><label for="password">{{$t('indexTitle.title101')}}</label>
									<input type="date" v-model="startTime">
								</div>
							</div>
							<div class="magBox">
								<div class="input-block"><label for="password">{{$t('indexTitle.title102')}}</label>
									<input type="date" v-model="endTime">
								</div>
							</div>
						</div>
						<div class="zhuyiBox">
							<img src="../../assets/images/zhuyi.png" alt="">
							{{$t('indexTitle.title103')}}
						</div>
						<div class="btnssss" @click="mountedfcTow">{{$t('indexTitle.title104')}}</div>
					</div>
				</div>
				<div class="member-center-profile">
					<div class="promo-ads-title">
						<div class="title">{{$t('indexTitle.title74')}}</div>
						<el-button>{{$t('indexTitle.title14')}}</el-button>
					</div>
					<div class="nodata">
						<div class="no-data">
							<img src="../../assets/images/nodata.svg" alt="" />
							<div>{{$t('indexTitle.title75')}}</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="jiazaidonghua" v-if="isloadingTowShow">
			<img src="../../assets/img/loading-ani.svg" alt="" />
		</div>
		<loadingFour :msgText="msgTextTow" :isShowCloseBot="isShowCloseBot" v-if="isShowLoadingTeow" @closeGuanbiTow="closeGuanbi"></loadingFour>
	</div>
</template>

<script>
	import {
		rechargelist,
		drawinglist,
		fslist,
		userinfo,
		youhuilist,
		shoudonglist
	} from "../../utils/api.js"
	import loadingFour from '../../components/loadingFour.vue';
	export default {

		data() {
			return {
				title: "",
				isJIfenShow: false,
				isShowLook: true,

				list: [],
				zong: 0,

				startTime: "",
				endTime: "",

				page: 1,

				info: [],
				tab: 8,
				isloadingTowShow: false,
				msgTextTow: "",
				isShowLoadingTeow: false,
				isShowCloseBot: false,
			}
		},
		components: {
			loadingFour
		},
		created() {},
		mounted() {
			this.title = this.$route.query.title;
			this.page = 1;
			this.info = JSON.parse(localStorage.getItem('userInfo'))
			// this.getuserinfo()

			var getTime = new Date().getTime(); //获取到当前时间戳
			var time = new Date(getTime); //创建一个日期对象
			this.nowDate(time);
		},

		methods: {
			closeGuanbi(e) {
				this.isShowLoadingTeow = false;
			},
			getuserinfo() {
				this.info = [];
				userinfo().then((res) => {
					if (res.status.errorCode == 0) {
						this.info = res.data;
						localStorage.setItem('userInfo', JSON.stringify(this.info))
					} else if (res.status.errorCode == 401) {
						this.$emit('getTokenNum', false)
						console.log('401')
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						this.isShowCloseBot = false;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			mountedfc() {
				this.isloadingTowShow = true;
				if (this.title == 0) {
					this.getrechargelist()
				} else if (this.title == 1) {
					this.getdrawinglist()
				} else if (this.title == 3) {
					this.getfslist()
				} else if (this.title == 2) {
					this.getyouhuilist()
				} else if (this.title == 4) {
					this.getshoudonglist()
				} else if (this.title == 5) {
					console.log(5)
					setTimeout(() => {
						this.isloadingTowShow = false;
					}, 1000)
				} else if (this.title == 6) {
					console.log(6)
					setTimeout(() => {
						this.isloadingTowShow = false;
					}, 1000)
				}
			},
			nowDate(time) {
				var year = time.getFullYear(); // 年
				var month = (time.getMonth() + 1).toString().padStart(2, '0'); // 月
				var date = time.getDate().toString().padStart(2, '0'); // 日
				this.startTime = year + "-" + month + "-" + date;
				this.endTime = year + "-" + month + "-" + date;

				this.mountedfc()
			},
			getrechargelist() {
				let data = {
					page: this.page,
					start_time: this.startTime,
					end_time: this.endTime
				}
				rechargelist(data).then((res) => {
					if (res.status.errorCode == 0) {
						this.list = res.data.data.data
						for (let i = 0; i < this.list.length; i++) {
							if (this.list[i].status == 2) {
								this.zong += Number(this.list[i].money)
							}
						}
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						this.isShowCloseBot = false;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
					this.isloadingTowShow = false;
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			getdrawinglist() {
				let data = {
					page: this.page,
					start_time: this.startTime,
					end_time: this.endTime
				}
				drawinglist(data).then((res) => {
					if (res.status.errorCode == 0) {
						this.list = res.data.data.data
						for (let i = 0; i < this.list.length; i++) {
							if (this.list[i].status == 2) {
								this.zong += Number(this.list[i].money)
							}
						}
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						this.isShowCloseBot = false;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
					this.isloadingTowShow = false;
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			getfslist() {
				let data = {
					page: this.page,
					start_time: this.startTime,
					end_time: this.endTime
				}
				fslist(data).then((res) => {
					if (res.status.errorCode == 0) {
						this.list = res.data.data
						for (let i = 0; i < this.list.length; i++) {
							if (this.list[i].status == 2) {
								this.zong += Number(this.list[i].money)
							}
						}
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						this.isShowCloseBot = false;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
					this.isloadingTowShow = false;
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			getyouhuilist() {
				let data = {
					start_time: this.startTime,
					end_time: this.endTime
				}
				youhuilist(data).then((res) => {
					if (res.status.errorCode == 0) {
						this.list = res.data.data
						for (let i = 0; i < this.list.length; i++) {
							if (this.list[i].status == 2) {
								this.zong += Number(this.list[i].money)
							}
						}
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						this.isShowCloseBot = false;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
					this.isloadingTowShow = false;
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			getshoudonglist() {
				let data = {
					start_time: this.startTime,
					end_time: this.endTime
				}
				shoudonglist(data).then((res) => {
					if (res.status.errorCode == 0) {
						this.list = res.data.data
						for (let i = 0; i < this.list.length; i++) {
							if (this.list[i].status == 2) {
								this.zong += Number(this.list[i].money)
							}
						}
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						this.isShowCloseBot = false;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
					this.isloadingTowShow = false;
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			mountedfcTow(){
				this.$router.push({
					path: '/promotion',
					query: {
						title: this.$route.query.title,
						page: this.page,
						startTime: this.startTime,
						endTime: this.endTime,
					}
				})
			},
			copyUrl(e) {
				let url = e
				let domInput = document.createElement('input');
				domInput.value = url;
				document.body.appendChild(domInput); // 添加input节点
				domInput.select(); // 选择对象;
				document.execCommand("Copy"); // 执行浏览器复制命令
				// this.$message.success(this.$t('indexTitle.title100'));
				this.msgTextTow = this.$t('indexTitle.title100');
				this.isShowLoadingTeow = true;
				this.isShowCloseBot = true;
				setTimeout(() => {
					this.isShowLoadingTeow = false;
				}, 2000)
				// this.$message({
				// 	showClose: true,
				// 	message: this.$t('indexTitle.title100'),
				// 	type: 'success'
				// });
				domInput.remove()
			},
			getShowJifen() {
				this.isJIfenShow = !this.isJIfenShow;
			},
			goNextPage(page) {
				this.$router.push(page)
			},
			getShowLook() {
				this.isShowLook = true;
			},
			goBack() {
				this.$router.push({
					path: '/promotion',
					query: {
						title: this.$route.query.title,
						page: this.page,
						startTime: this.startTime,
						endTime: this.endTime,
					}
				})
				// this.$router.push({
				// 	path: '/finan-history',
				// })
				// this.$router.go(-1)
			}
		}
	}
</script>

<style scoped>
	* {
		box-sizing: border-box;
	}

	.mine {
		position: relative;
		/* padding-bottom: calc(50px + env(safe-area-inset-bottom)); */
	}

	.member-center-main {
		color: #545658;
		display: flex;
		justify-content: center;
		margin: 0 auto;
		max-width: 1280px;
		padding: 20px 0;
		width: 100%;
	}

	.member-center-menu {
		overflow: hidden;
		width: 220px;
	}

	.info-block {
		align-items: center;
		border-bottom: 1px solid #e9e9e9;
		display: flex;
		padding: 30px 15px 15px;
	}

	.playerid {
		font-size: 22px;
		font-weight: 600;
		word-break: break-all;
	}

	.balance-info {
		align-items: flex-end;
		border-bottom: 1px solid #e9e9e9;
		display: flex;
		justify-content: space-between;
		padding: 15px;
	}

	.currency {
		padding-right: 8px;
	}

	.balance {
		font-size: 18px;
		font-weight: 500;
	}

	.nav-block {
		align-items: center;
		display: flex;
		flex-direction: column;
	}

	.item {
		align-items: center;
		box-sizing: border-box;
		color: #939698;
		cursor: pointer;
		display: flex;
		height: 60px;
		line-height: 1.4;
		padding: 0 15px;
		position: relative;
		transition: .3s ease;
		width: 100%;
	}

	.item.active {
		color: #5235ff;
	}

	.item:hover {
		color: #5235ff;
	}

	.item img {
		width: 28px;
		height: 28px;
		margin-right: 12px;
	}

	.item .label {
		font-size: 16px;
		font-weight: 500;
		line-height: 1.2;
	}

	.member-center-content {
		background: #f9f9f9;
		border-radius: 10px;
		box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .15);
		display: flex;
		justify-content: space-between;
		min-height: 700px;
		overflow: hidden;
		position: relative;
		width: calc(100% - 220px);
	}

	.member-center-profile {
		padding: 24px;
		width: 50%;
		position: relative;
	}

	.promo-ads-title {
		display: flex;
		justify-content: space-between;
		margin-bottom: 10px;
	}

	.el-button {
		border-radius: 5px;
		height: 29px;
		padding: 5px 20px;
		background-color: #5235ff;
		border: 0;
		color: #fff;
		cursor: pointer;
		font-size: 16px;
	}

	.nodata {
		height: 700px;
		overflow: auto;
	}

	.no-data {
		align-items: center;
		color: #545658;
		display: flex;
		flex-direction: column;
		margin-top: 150px;
	}

	.no-data img {
		width: 50%;
	}

	.title-wrapper {
		align-items: center;
		display: flex;
		margin-bottom: 10px;
	}

	.title-wrapper .left {
		color: #545658;
		margin-right: 10px;
		width: 22px;
		height: 22px;
		cursor: pointer;
	}

	.title-wrapper .title {
		font-size: 19px;
		font-weight: 600;
		line-height: 24px;
		color: #545658;
		margin-bottom: 0;
	}

	.title {
		color: #545658;
		margin-bottom: 25px;
		font-size: 19px;
		font-weight: 600;
		line-height: 24px;
	}

	.proList {
		width: 100%;
		padding: 0 15px 10px;
	}

	.proList.padtop {
		padding-top: 10px;
	}

	.adsfList {
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 12px;
		padding: 0px 15px;
		height: 27px;
		border-bottom: 1px solid #e9e9e9;
	}

	.adsfListTow {
		border-bottom: none;
	}

	.adsfListL {
		color: #939698;
	}

	.adsfListR {
		color: #545658;
		font-weight: 500;
	}

	.dafadBopx {
		width: 100%;
		margin-top: 10px;
	}

	/* .dagfdsBox{
		width: 100%;
		height: 70vh;
		overflow-y: scroll;
	} */

	.jiaqianBox {
		width: 100%;
		/* height: 90px; */
		padding: 12px 15px 5px;
		border: 1px solid #ececec;
		background: #fafafc;
		border-radius: 5px 5px 0px 0px;
	}

	.jiaqianBoxIt {
		color: #939698;
		font-size: 12px;
		line-height: 1;
		opacity: 0.8;
		margin-bottom: 8px;
	}

	.jiaqianBoxItTow {
		font-size: 16px;
		font-weight: 500;
		color: #939698;
	}

	.jiaqianBoxItThree {
		margin-top: 5px;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.jiaqianBoxItThreeL {
		color: #939698;
		font-size: 12px;
		line-height: 1;
		opacity: 0.8;
		margin-bottom: 8px;
	}

	.jiaqianBoxItThreeR {
		color: #545658;
		font-weight: 500;
		font-size: 20px;
	}

	.vipjilu {
		display: flex;
		justify-content: flex-end;
		margin-bottom: 10px;
		padding-right: 20px;
	}

	.vipjilu img {
		width: 25px;
		height: 25px;
	}

	.gengduoBox {
		background-color: #e1e1e1;
		color: #838383;
		cursor: pointer;
		font-size: 14px;
		padding: 8px 15px;
		text-align: center;
		display: none;
		border-radius: 0px 0px 5px 5px;
	}

	.gengduoBoxTow {
		display: block;
	}


	.jifenBoxTow {
		width: 100%;
		height: 60px;
		display: block;
		padding: 7px 10px 10px;
		border: 1px solid #ececec;
		border-top: none;
		background-color: #fafafc;
	}

	.beizhuBox {
		width: 100%;
		height: 42px;
		border: 2px solid #e9e9e9;
		border-radius: 5px;
		display: flex;
		padding: 0px 15px 0px 3px;
		align-items: center;
		justify-content: space-between;
	}

	.beizhuBoxL {
		width: 90%;
		font-size: 12px;
		color: #545658;
		opacity: 0.7;
		font-size: 12px;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.beizhuBoxR {
		width: 10%;
		text-align: center;
	}

	.jifenBoxThree {
		display: none;
	}

	.beizhuBoxR img {
		width: 20px;
		height: 20px;
	}

	.gengduoBoxTow {
		display: block;
	}

	.dfafaTimeBox {
		width: 100%;
		margin: 5px auto 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.magBox {
		width: 49%;
		border-radius: 5px;
		box-sizing: border-box;
		display: flex;
		height: 54px;
		justify-content: space-around;
		padding: 0 10px;
		background-color: #fbfbfb;
		border: 1px solid #e9e9e9;
		color: #777;
		font-weight: 300;
	}

	.input-block {
		box-sizing: border-box;
		position: relative;
		width: 100%;
	}

	.input-block label {
		color: #a0a3a5;
		line-height: 1.29;
		pointer-events: none;
		position: absolute;
		font-size: 10px !important;
		top: 8px !important;
		font-weight: 300;
	}

	.input-block input {
		background-color: transparent;
		color: #545658;
		border: none !important;
		box-sizing: border-box;
		position: absolute;
		width: 100%;
		outline: medium;
		padding: 0;
		font-size: 14px !important;
		font-family: sans-serif;
		font-size: 100%;
		line-height: 1.15;
		margin: 0;
		height: 28px !important;
		box-shadow: none !important;
		top: 24px !important;
	}

	.zhuyiBox img {
		width: 15px;
		height: 15px;
		margin-right: 5px;
	}

	.zhuyiBox {
		display: flex;
		font-size: 12px;
		margin: 5px auto 10px;
		color: #86898c;
		font-weight: 300;
		width: 95%;
	}

	.btnssss {
		background-color: #7240ff;
		border: none;
		border-radius: 3px;
		color: #fff;
		cursor: pointer;
		font-size: 16px;
		font-stretch: normal;
		font-style: normal;
		font-weight: 300;
		height: 44px;
		width: 100%;
		margin: 20px auto 0;
		text-align: center;
		line-height: 44px;
	}

	.zanwujiluBox {
		width: 100%;
		height: calc(100vh - 238px);
		display: flex;
		align-items: center;
		flex-direction: column;
		justify-content: center;
		opacity: .6;
		color: #545658;
		font-weight: 300;
	}

	.row {
		align-items: center;
		color: #939698;
		display: flex;
		font-size: 12px;
		justify-content: space-between;
		line-height: 1;
		margin-bottom: 8px;
	}

	.status-row {
		min-height: 50px;
	}

	.application-time {
		display: flex;
		margin-top: 10px;
		white-space: pre;
	}

	.status {
		align-items: center;
		background-color: #e7e7e7;
		border-radius: 2px;
		color: #939698;
		display: flex;
		font-size: 12px;
		height: 20px;
		justify-content: center;
		line-height: 20px;
		max-width: 150px;
		padding: 0 10px;
		white-space: nowrap;
	}

	.status.failed {
		background: #e94951;
		color: #fff;
	}

	.status.success {
		background: #9ac143;
		color: #fff;
	}

	.status.expired {
		background: #939698;
		color: #fff;
	}

	.card-more-btn {
		background-color: #e1e1e1;
		color: #838383;
		cursor: pointer;
		font-size: 14px;
		padding: 8px 15px;
		align-items: center;
		display: flex;
		justify-content: space-between;
		text-align: initial;
		border-radius: 0px 0px 5px 5px;
	}

	.text-overflow {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		width: 90%;
	}

	.titles {
		margin-right: 10px;
	}

	.card-more-btn img {
		width: 18px;
		height: 18px;
		margin-left: 5px;
	}

	.jiazaidonghua {
		height: 100px;
		width: 100px;
		background-color: #313131;
		position: absolute;
		top: 40%;
		left: 50%;
		transform: translate(-50%, -50%);
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 10px;
	}

	.jiazaidonghua img {
		height: 45px;
		width: 45px;
	}
</style>